<%@codepage="65001"%>
<%session.codepage="65001"%>
<!-- #include virtual=/inc/dbConn.asp -->
<!-- #include virtual=/inc/function.asp -->
<!-- #include virtual=/inc/action.header.inc.asp -->

<%
	'## 파라미터 변수 선언부
	processCd		= Request("processCd")
	fullLotNo		= Request("fullLotNo")
	lotSubNo		= Request("lotSubNo")
	posit			= (Request("posit") +1)
	
	SQLTitle = "-- ■■■■ 단위공정 관리 상세 정보 ■■■■"
	
	If fullLotNo = "" Then 
		SQL = "SELECT processCd, processNm, working, execTime, type FROM tblUnitProcess WHERE processCd='" & processCd & "'"
	Else
		SQL = "SELECT A.processCd, A.processNm, ISNULL(B.working,A.working) working, B.execTime, A.type, B.goodQty, B.badQty, B.etc, B.workDt, B.userId, B.rank " & _
			  "	FROM tblUnitProcess A " & _
			  "	LEFT JOIN (SELECT * FROM tblOrderResult WHERE lotYear+lotNo='" & fullLotNo & "' AND lotSubNo=" & lotSubNo & " AND flag='Y') B ON A.processCd=B.processCd " & _
			  " WHERE A.processCd='" & processCd & "' ORDER BY B.workDt"
	End If 
'Response.write SQL
	If xMode="debug" Then 
		Call showDebug(SQLTitle,SQL) 
	End If 

	Set Rs=Server.CreateObject("ADODB.RecordSet")
	Rs.open SQL, DbCon, 1
	
	Response.write "<ProcDetailInfo>" & vbcrlf

	If Rs.eof Or Rs.bof Then 
	Else 
		Do Until Rs.eof Or Rs.bof

			Response.write "	<ProcDetail>" & vbcrlf
			Call mkXMLNode("processCd", rs("processCd"), 2)
			Call mkXMLNode("processNm", rs("processNm"), 2)
			Call mkXMLNode("working", rs("working"), 2)
			Call mkXMLNode("execTime", rs("execTime"), 2)
			Call mkXMLNode("type", rs("type"), 2)
			If fullLotNo <> "" Then 
				Call mkXMLNode("goodQty", rs("goodQty"), 2)
				Call mkXMLNode("badQty", rs("badQty"), 2)
				Call mkXMLNode("etc", rs("etc"), 2)
				Call mkXMLNode("workDt", rs("workDt"), 2)
				Call mkXMLNode("userId", rs("userId"), 2)
				Call mkXMLNode("rank", rs("rank"), 2)
			End If 
			Call mkXMLNode("posit", posit, 2)
			Response.write "	</ProcDetail>" & vbcrlf

		Rs.movenext
		Loop 
	End If
	Response.write "</ProcDetailInfo>" & vbcrlf
'	Call rsWithXML("Save OK!")
%>